<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test::Builder - Backend for building test libraries - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Test::Builder">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test::Builder.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Test::Builder">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Test::Builder">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Test::Builder">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Test::Builder">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Test::Builder">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Test::Builder">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Test::Builder">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Test::Builder">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Test::Builder">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Test::Builder">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Test::Builder">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Test::Builder">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Test::Builder">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Test::Builder">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Test::Builder">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Test::Builder">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Test::Builder">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Test::Builder">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Test::Builder">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Test::Builder">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Test::Builder">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Test::Builder">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Test::Builder">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Test::Builder">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Test::Builder">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Test::Builder">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Test::Builder">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Test::Builder">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Test::Builder">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Test::Builder">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Test::Builder">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Test::Builder">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Test::Builder">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Test::Builder">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Test::Builder">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Test::Builder">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Test::Builder">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Test::Builder">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Test::Builder">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Test::Builder">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Test::Builder">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Test::Builder">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Test::Builder">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Test::Builder">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Test::Builder">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Test::Builder">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Test::Builder">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Test::Builder">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Test::Builder">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Test::Builder">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Test::Builder">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Test::Builder">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Test::Builder">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Test::Builder">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Test::Builder">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Test::Builder">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Test::Builder">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Test::Builder">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Test::Builder">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Test::Builder">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Test::Builder">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Test::Builder">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Test::Builder">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Test::Builder">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Test::Builder">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Test::Builder">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Test::Builder">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Test::Builder">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Test::Builder">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Test::Builder">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Test::Builder">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Test::Builder">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Test::Builder">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Test::Builder">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Test::Builder">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Test::Builder">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Test::Builder">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Test::Builder">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Test::Builder">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Test::Builder">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test::Builder.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Test::Builder">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Test::Builder">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Test::Builder">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Test::Builder">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Test::Builder">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Test::Builder">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Test::Builder">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Test::Builder">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Test::Builder">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Test::Builder">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Test::Builder">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Test::Builder">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Test::Builder">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Test::Builder">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Test::Builder">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Test::Builder">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Test::Builder">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Test::Builder">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Test::Builder">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Test::Builder">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Test::Builder">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Test::Builder">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Test::Builder">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Test::Builder">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Test::Builder">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Test::Builder">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Test::Builder">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Test::Builder">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Test::Builder">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Test::Builder">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Test::Builder">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Test::Builder">5.35.1</a>
          <a class="dropdown-item active" href="./Test::Builder.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test::Builder.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Test::Builder.html">Test::Builder</a>
          <div id="more">
            (<a href="./Test::Builder.txt">source</a>,
            <a href="https://metacpan.org/pod/Test::Builder">CPAN</a>)
          </div>
            <div id="moduleversion">version 1.302183</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#DESCRIPTION">DESCRIPTION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Construction">Construction</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Setting-up-tests">Setting up tests</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Running-tests">Running tests</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Other-Testing-Methods">Other Testing Methods</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Test-building-utility-methods">Test building utility methods</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Test-style">Test style</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Output">Output</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#Test-Status-and-Info">Test Status and Info</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#EXIT-CODES">EXIT CODES</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#THREADS">THREADS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#MEMORY">MEMORY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#EXAMPLES">EXAMPLES</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#SEE-ALSO">SEE ALSO</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#INTERNALS">INTERNALS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#LEGACY">LEGACY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#EXTERNAL">EXTERNAL</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#AUTHORS">AUTHORS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#MAINTAINERS">MAINTAINERS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test::Builder.html#COPYRIGHT">COPYRIGHT</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Test::Builder.html#NAME">#</a>NAME</h1>

<p>Test::Builder - Backend for building test libraries</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Test::Builder.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>package My::Test::Module;
use base &#39;Test::Builder::Module&#39;;

my $CLASS = __PACKAGE__;

sub ok {
    my($test, $name) = @_;
    my $tb = $CLASS-&gt;builder;

    $tb-&gt;ok($test, $name);
}</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./Test::Builder.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p><a href="./Test::Simple.html">Test::Simple</a> and <a href="./Test::More.html">Test::More</a> have proven to be popular testing modules, but they&#39;re not always flexible enough. Test::Builder provides a building block upon which to write your own test libraries <i>which can work together</i>.</p>

<h2 id="Construction"><a class="permalink" href="./Test::Builder.html#Construction">#</a>Construction</h2>

<dl>

<dt id="new"><a class="permalink" href="./Test::Builder.html#new">#</a><b>new</b></dt>
<dd>

<pre><code>my $Test = Test::Builder-&gt;new;</code></pre>

<p>Returns a Test::Builder object representing the current state of the test.</p>

<p>Since you only run one test per program <code>new</code> always returns the same Test::Builder object. No matter how many times you call <code>new()</code>, you&#39;re getting the same object. This is called a singleton. This is done so that multiple modules share such global information as the test counter and where test output is going.</p>

<p>If you want a completely new Test::Builder object different from the singleton, use <code>create</code>.</p>

</dd>
<dt id="create"><a class="permalink" href="./Test::Builder.html#create">#</a><b>create</b></dt>
<dd>

<pre><code>my $Test = Test::Builder-&gt;create;</code></pre>

<p>Ok, so there can be more than one Test::Builder object and this is how you get it. You might use this instead of <code>new()</code> if you&#39;re testing a Test::Builder based module, but otherwise you probably want <code>new</code>.</p>

<p><b>NOTE</b>: the implementation is not complete. <code>level</code>, for example, is still shared by <b>all</b> Test::Builder objects, even ones created using this method. Also, the method name may change in the future.</p>

</dd>
<dt id="subtest"><a class="permalink" href="./Test::Builder.html#subtest">#</a><b>subtest</b></dt>
<dd>

<pre><code>$builder-&gt;subtest($name, \&amp;subtests, @args);</code></pre>

<p>See documentation of <code>subtest</code> in Test::More.</p>

<p><code>subtest</code> also, and optionally, accepts arguments which will be passed to the subtests reference.</p>

</dd>
<dt id="name"><a class="permalink" href="./Test::Builder.html#name">#</a><b>name</b></dt>
<dd>

<pre><code>diag $builder-&gt;name;</code></pre>

<p>Returns the name of the current builder. Top level builders default to <code>$0</code> (the name of the executable). Child builders are named via the <code>child</code> method. If no name is supplied, will be named &quot;Child of $parent-&gt;name&quot;.</p>

</dd>
<dt id="reset"><a class="permalink" href="./Test::Builder.html#reset">#</a><b>reset</b></dt>
<dd>

<pre><code>$Test-&gt;reset;</code></pre>

<p>Reinitializes the Test::Builder singleton to its original state. Mostly useful for tests run in persistent environments where the same test might be run multiple times in the same process.</p>

</dd>
</dl>

<h2 id="Setting-up-tests"><a class="permalink" href="./Test::Builder.html#Setting-up-tests">#</a><a id="Setting"></a>Setting up tests</h2>

<p>These methods are for setting up tests and declaring how many there are. You usually only want to call one of these methods.</p>

<dl>

<dt id="plan"><a class="permalink" href="./Test::Builder.html#plan">#</a><b>plan</b></dt>
<dd>

<pre><code>$Test-&gt;plan(&#39;no_plan&#39;);
$Test-&gt;plan( skip_all =&gt; $reason );
$Test-&gt;plan( tests =&gt; $num_tests );</code></pre>

<p>A convenient way to set up your tests. Call this and Test::Builder will print the appropriate headers and take the appropriate actions.</p>

<p>If you call <code>plan()</code>, don&#39;t call any of the other methods below.</p>

</dd>
<dt id="expected_tests"><a class="permalink" href="./Test::Builder.html#expected_tests">#</a><b>expected_tests</b></dt>
<dd>

<pre><code>my $max = $Test-&gt;expected_tests;
$Test-&gt;expected_tests($max);</code></pre>

<p>Gets/sets the number of tests we expect this test to run and prints out the appropriate headers.</p>

</dd>
<dt id="no_plan"><a class="permalink" href="./Test::Builder.html#no_plan">#</a><b>no_plan</b></dt>
<dd>

<pre><code>$Test-&gt;no_plan;</code></pre>

<p>Declares that this test will run an indeterminate number of tests.</p>

</dd>
<dt id="done_testing"><a class="permalink" href="./Test::Builder.html#done_testing">#</a><b>done_testing</b></dt>
<dd>

<pre><code>$Test-&gt;done_testing();
$Test-&gt;done_testing($num_tests);</code></pre>

<p>Declares that you are done testing, no more tests will be run after this point.</p>

<p>If a plan has not yet been output, it will do so.</p>

<p>$num_tests is the number of tests you planned to run. If a numbered plan was already declared, and if this contradicts, a failing test will be run to reflect the planning mistake. If <code>no_plan</code> was declared, this will override.</p>

<p>If <code>done_testing()</code> is called twice, the second call will issue a failing test.</p>

<p>If <code>$num_tests</code> is omitted, the number of tests run will be used, like no_plan.</p>

<p><code>done_testing()</code> is, in effect, used when you&#39;d want to use <code>no_plan</code>, but safer. You&#39;d use it like so:</p>

<pre><code>$Test-&gt;ok($a == $b);
$Test-&gt;done_testing();</code></pre>

<p>Or to plan a variable number of tests:</p>

<pre><code>for my $test (@tests) {
    $Test-&gt;ok($test);
}
$Test-&gt;done_testing(scalar @tests);</code></pre>

</dd>
<dt id="has_plan"><a class="permalink" href="./Test::Builder.html#has_plan">#</a><b>has_plan</b></dt>
<dd>

<pre><code>$plan = $Test-&gt;has_plan</code></pre>

<p>Find out whether a plan has been defined. <code>$plan</code> is either <code>undef</code> (no plan has been set), <code>no_plan</code> (indeterminate # of tests) or an integer (the number of expected tests).</p>

</dd>
<dt id="skip_all"><a class="permalink" href="./Test::Builder.html#skip_all">#</a><b>skip_all</b></dt>
<dd>

<pre><code>$Test-&gt;skip_all;
$Test-&gt;skip_all($reason);</code></pre>

<p>Skips all the tests, using the given <code>$reason</code>. Exits immediately with 0.</p>

</dd>
<dt id="exported_to"><a class="permalink" href="./Test::Builder.html#exported_to">#</a><b>exported_to</b></dt>
<dd>

<pre><code>my $pack = $Test-&gt;exported_to;
$Test-&gt;exported_to($pack);</code></pre>

<p>Tells Test::Builder what package you exported your functions to.</p>

<p>This method isn&#39;t terribly useful since modules which share the same Test::Builder object might get exported to different packages and only the last one will be honored.</p>

</dd>
</dl>

<h2 id="Running-tests"><a class="permalink" href="./Test::Builder.html#Running-tests">#</a><a id="Running"></a>Running tests</h2>

<p>These actually run the tests, analogous to the functions in Test::More.</p>

<p>They all return true if the test passed, false if the test failed.</p>

<p><code>$name</code> is always optional.</p>

<dl>

<dt id="ok"><a class="permalink" href="./Test::Builder.html#ok">#</a><b>ok</b></dt>
<dd>

<pre><code>$Test-&gt;ok($test, $name);</code></pre>

<p>Your basic test. Pass if <code>$test</code> is true, fail if $test is false. Just like Test::Simple&#39;s <code>ok()</code>.</p>

</dd>
<dt id="is_eq"><a class="permalink" href="./Test::Builder.html#is_eq">#</a><b>is_eq</b></dt>
<dd>

<pre><code>$Test-&gt;is_eq($got, $expected, $name);</code></pre>

<p>Like Test::More&#39;s <code>is()</code>. Checks if <code>$got eq $expected</code>. This is the string version.</p>

<p><code>undef</code> only ever matches another <code>undef</code>.</p>

</dd>
<dt id="is_num"><a class="permalink" href="./Test::Builder.html#is_num">#</a><b>is_num</b></dt>
<dd>

<pre><code>$Test-&gt;is_num($got, $expected, $name);</code></pre>

<p>Like Test::More&#39;s <code>is()</code>. Checks if <code>$got == $expected</code>. This is the numeric version.</p>

<p><code>undef</code> only ever matches another <code>undef</code>.</p>

</dd>
<dt id="isnt_eq"><a class="permalink" href="./Test::Builder.html#isnt_eq">#</a><b>isnt_eq</b></dt>
<dd>

<pre><code>$Test-&gt;isnt_eq($got, $dont_expect, $name);</code></pre>

<p>Like <a href="./Test::More.html">Test::More</a>&#39;s <code>isnt()</code>. Checks if <code>$got ne $dont_expect</code>. This is the string version.</p>

</dd>
<dt id="isnt_num"><a class="permalink" href="./Test::Builder.html#isnt_num">#</a><b>isnt_num</b></dt>
<dd>

<pre><code>$Test-&gt;isnt_num($got, $dont_expect, $name);</code></pre>

<p>Like <a href="./Test::More.html">Test::More</a>&#39;s <code>isnt()</code>. Checks if <code>$got ne $dont_expect</code>. This is the numeric version.</p>

</dd>
<dt id="like"><a class="permalink" href="./Test::Builder.html#like">#</a><b>like</b></dt>
<dd>

<pre><code>$Test-&gt;like($thing, qr/$regex/, $name);
$Test-&gt;like($thing, &#39;/$regex/&#39;, $name);</code></pre>

<p>Like <a href="./Test::More.html">Test::More</a>&#39;s <code>like()</code>. Checks if $thing matches the given <code>$regex</code>.</p>

</dd>
<dt id="unlike"><a class="permalink" href="./Test::Builder.html#unlike">#</a><b>unlike</b></dt>
<dd>

<pre><code>$Test-&gt;unlike($thing, qr/$regex/, $name);
$Test-&gt;unlike($thing, &#39;/$regex/&#39;, $name);</code></pre>

<p>Like <a href="./Test::More.html">Test::More</a>&#39;s <code>unlike()</code>. Checks if $thing <b>does not match</b> the given <code>$regex</code>.</p>

</dd>
<dt id="cmp_ok"><a class="permalink" href="./Test::Builder.html#cmp_ok">#</a><b>cmp_ok</b></dt>
<dd>

<pre><code>$Test-&gt;cmp_ok($thing, $type, $that, $name);</code></pre>

<p>Works just like <a href="./Test::More.html">Test::More</a>&#39;s <code>cmp_ok()</code>.</p>

<pre><code>$Test-&gt;cmp_ok($big_num, &#39;!=&#39;, $other_big_num);</code></pre>

</dd>
</dl>

<h2 id="Other-Testing-Methods"><a class="permalink" href="./Test::Builder.html#Other-Testing-Methods">#</a><a id="Other"></a>Other Testing Methods</h2>

<p>These are methods which are used in the course of writing a test but are not themselves tests.</p>

<dl>

<dt id="BAIL_OUT"><a class="permalink" href="./Test::Builder.html#BAIL_OUT">#</a><b>BAIL_OUT</b></dt>
<dd>

<pre><code>$Test-&gt;BAIL_OUT($reason);</code></pre>

<p>Indicates to the <a href="./Test::Harness.html">Test::Harness</a> that things are going so badly all testing should terminate. This includes running any additional test scripts.</p>

<p>It will exit with 255.</p>

</dd>
<dt id="skip"><a class="permalink" href="./Test::Builder.html#skip">#</a><b>skip</b></dt>
<dd>

<pre><code>$Test-&gt;skip;
$Test-&gt;skip($why);</code></pre>

<p>Skips the current test, reporting <code>$why</code>.</p>

</dd>
<dt id="todo_skip"><a class="permalink" href="./Test::Builder.html#todo_skip">#</a><b>todo_skip</b></dt>
<dd>

<pre><code>$Test-&gt;todo_skip;
$Test-&gt;todo_skip($why);</code></pre>

<p>Like <code>skip()</code>, only it will declare the test as failing and TODO. Similar to</p>

<pre><code>print &quot;not ok $tnum # TODO $why\n&quot;;</code></pre>

</dd>
</dl>

<h2 id="Test-building-utility-methods"><a class="permalink" href="./Test::Builder.html#Test-building-utility-methods">#</a><a id="Test"></a>Test building utility methods</h2>

<p>These methods are useful when writing your own test methods.</p>

<dl>

<dt id="maybe_regex"><a class="permalink" href="./Test::Builder.html#maybe_regex">#</a><b>maybe_regex</b></dt>
<dd>

<pre><code>$Test-&gt;maybe_regex(qr/$regex/);
$Test-&gt;maybe_regex(&#39;/$regex/&#39;);</code></pre>

<p>This method used to be useful back when Test::Builder worked on Perls before 5.6 which didn&#39;t have qr//. Now its pretty useless.</p>

<p>Convenience method for building testing functions that take regular expressions as arguments.</p>

<p>Takes a quoted regular expression produced by <code>qr//</code>, or a string representing a regular expression.</p>

<p>Returns a Perl value which may be used instead of the corresponding regular expression, or <code>undef</code> if its argument is not recognized.</p>

<p>For example, a version of <code>like()</code>, sans the useful diagnostic messages, could be written as:</p>

<pre><code>sub laconic_like {
    my ($self, $thing, $regex, $name) = @_;
    my $usable_regex = $self-&gt;maybe_regex($regex);
    die &quot;expecting regex, found &#39;$regex&#39;\n&quot;
        unless $usable_regex;
    $self-&gt;ok($thing =~ m/$usable_regex/, $name);
}</code></pre>

</dd>
<dt id="is_fh"><a class="permalink" href="./Test::Builder.html#is_fh">#</a><b>is_fh</b></dt>
<dd>

<pre><code>my $is_fh = $Test-&gt;is_fh($thing);</code></pre>

<p>Determines if the given <code>$thing</code> can be used as a filehandle.</p>

</dd>
</dl>

<h2 id="Test-style"><a class="permalink" href="./Test::Builder.html#Test-style">#</a><a id="Test1"></a>Test style</h2>

<dl>

<dt id="level"><a class="permalink" href="./Test::Builder.html#level">#</a><b>level</b></dt>
<dd>

<pre><code>$Test-&gt;level($how_high);</code></pre>

<p>How far up the call stack should <code>$Test</code> look when reporting where the test failed.</p>

<p>Defaults to 1.</p>

<p>Setting <code>$Test::Builder::Level</code> overrides. This is typically useful localized:</p>

<pre><code>sub my_ok {
    my $test = shift;

    local $Test::Builder::Level = $Test::Builder::Level + 1;
    $TB-&gt;ok($test);
}</code></pre>

<p>To be polite to other functions wrapping your own you usually want to increment <code>$Level</code> rather than set it to a constant.</p>

</dd>
<dt id="use_numbers"><a class="permalink" href="./Test::Builder.html#use_numbers">#</a><b>use_numbers</b></dt>
<dd>

<pre><code>$Test-&gt;use_numbers($on_or_off);</code></pre>

<p>Whether or not the test should output numbers. That is, this if true:</p>

<pre><code class="plaintext">ok 1
ok 2
ok 3</code></pre>

<p>or this if false</p>

<pre><code class="plaintext">ok
ok
ok</code></pre>

<p>Most useful when you can&#39;t depend on the test output order, such as when threads or forking is involved.</p>

<p>Defaults to on.</p>

</dd>
<dt id="no_diag"><a class="permalink" href="./Test::Builder.html#no_diag">#</a><b>no_diag</b></dt>
<dd>

<pre><code>$Test-&gt;no_diag($no_diag);</code></pre>

<p>If set true no diagnostics will be printed. This includes calls to <code>diag()</code>.</p>

</dd>
<dt id="no_ending"><a class="permalink" href="./Test::Builder.html#no_ending">#</a><b>no_ending</b></dt>
<dd>

<pre><code>$Test-&gt;no_ending($no_ending);</code></pre>

<p>Normally, Test::Builder does some extra diagnostics when the test ends. It also changes the exit code as described below.</p>

<p>If this is true, none of that will be done.</p>

</dd>
<dt id="no_header"><a class="permalink" href="./Test::Builder.html#no_header">#</a><b>no_header</b></dt>
<dd>

<pre><code>$Test-&gt;no_header($no_header);</code></pre>

<p>If set to true, no &quot;1..N&quot; header will be printed.</p>

</dd>
</dl>

<h2 id="Output"><a class="permalink" href="./Test::Builder.html#Output">#</a>Output</h2>

<p>Controlling where the test output goes.</p>

<p>It&#39;s ok for your test to change where STDOUT and STDERR point to, Test::Builder&#39;s default output settings will not be affected.</p>

<dl>

<dt id="diag"><a class="permalink" href="./Test::Builder.html#diag">#</a><b>diag</b></dt>
<dd>

<pre><code>$Test-&gt;diag(@msgs);</code></pre>

<p>Prints out the given <code>@msgs</code>. Like <code>print</code>, arguments are simply appended together.</p>

<p>Normally, it uses the <code>failure_output()</code> handle, but if this is for a TODO test, the <code>todo_output()</code> handle is used.</p>

<p>Output will be indented and marked with a # so as not to interfere with test output. A newline will be put on the end if there isn&#39;t one already.</p>

<p>We encourage using this rather than calling print directly.</p>

<p>Returns false. Why? Because <code>diag()</code> is often used in conjunction with a failing test (<code>ok() || diag()</code>) it &quot;passes through&quot; the failure.</p>

<pre><code>return ok(...) || diag(...);</code></pre>

</dd>
<dt id="note"><a class="permalink" href="./Test::Builder.html#note">#</a><b>note</b></dt>
<dd>

<pre><code>$Test-&gt;note(@msgs);</code></pre>

<p>Like <code>diag()</code>, but it prints to the <code>output()</code> handle so it will not normally be seen by the user except in verbose mode.</p>

</dd>
<dt id="explain"><a class="permalink" href="./Test::Builder.html#explain">#</a><b>explain</b></dt>
<dd>

<pre><code>my @dump = $Test-&gt;explain(@msgs);</code></pre>

<p>Will dump the contents of any references in a human readable format. Handy for things like...</p>

<pre><code>is_deeply($have, $want) || diag explain $have;</code></pre>

<p>or</p>

<pre><code>is_deeply($have, $want) || note explain $have;</code></pre>

</dd>
<dt id="output"><a class="permalink" href="./Test::Builder.html#output">#</a><b>output</b></dt>
<dd>

</dd>
<dt id="failure_output"><a class="permalink" href="./Test::Builder.html#failure_output">#</a><b>failure_output</b></dt>
<dd>

</dd>
<dt id="todo_output"><a class="permalink" href="./Test::Builder.html#todo_output">#</a><b>todo_output</b></dt>
<dd>

<pre><code>my $filehandle = $Test-&gt;output;
$Test-&gt;output($filehandle);
$Test-&gt;output($filename);
$Test-&gt;output(\$scalar);</code></pre>

<p>These methods control where Test::Builder will print its output. They take either an open <code>$filehandle</code>, a <code>$filename</code> to open and write to or a <code>$scalar</code> reference to append to. It will always return a <code>$filehandle</code>.</p>

<p><b>output</b> is where normal &quot;ok/not ok&quot; test output goes.</p>

<p>Defaults to STDOUT.</p>

<p><b>failure_output</b> is where diagnostic output on test failures and <code>diag()</code> goes. It is normally not read by Test::Harness and instead is displayed to the user.</p>

<p>Defaults to STDERR.</p>

<p><code>todo_output</code> is used instead of <code>failure_output()</code> for the diagnostics of a failing TODO test. These will not be seen by the user.</p>

<p>Defaults to STDOUT.</p>

</dd>
<dt id="reset_outputs"><a class="permalink" href="./Test::Builder.html#reset_outputs">#</a>reset_outputs</dt>
<dd>

<pre><code>$tb-&gt;reset_outputs;</code></pre>

<p>Resets all the output filehandles back to their defaults.</p>

</dd>
<dt id="carp"><a class="permalink" href="./Test::Builder.html#carp">#</a>carp</dt>
<dd>

<pre><code>$tb-&gt;carp(@message);</code></pre>

<p>Warns with <code>@message</code> but the message will appear to come from the point where the original test function was called (<code>$tb-&gt;caller</code>).</p>

</dd>
<dt id="croak"><a class="permalink" href="./Test::Builder.html#croak">#</a>croak</dt>
<dd>

<pre><code>$tb-&gt;croak(@message);</code></pre>

<p>Dies with <code>@message</code> but the message will appear to come from the point where the original test function was called (<code>$tb-&gt;caller</code>).</p>

</dd>
</dl>

<h2 id="Test-Status-and-Info"><a class="permalink" href="./Test::Builder.html#Test-Status-and-Info">#</a><a id="Test2"></a>Test Status and Info</h2>

<dl>

<dt id="no_log_results"><a class="permalink" href="./Test::Builder.html#no_log_results">#</a><b>no_log_results</b></dt>
<dd>

<p>This will turn off result long-term storage. Calling this method will make <code>details</code> and <code>summary</code> useless. You may want to use this if you are running enough tests to fill up all available memory.</p>

<pre><code>Test::Builder-&gt;new-&gt;no_log_results();</code></pre>

<p>There is no way to turn it back on.</p>

</dd>
<dt id="current_test"><a class="permalink" href="./Test::Builder.html#current_test">#</a><b>current_test</b></dt>
<dd>

<pre><code>my $curr_test = $Test-&gt;current_test;
$Test-&gt;current_test($num);</code></pre>

<p>Gets/sets the current test number we&#39;re on. You usually shouldn&#39;t have to set this.</p>

<p>If set forward, the details of the missing tests are filled in as &#39;unknown&#39;. if set backward, the details of the intervening tests are deleted. You can erase history if you really want to.</p>

</dd>
<dt id="is_passing"><a class="permalink" href="./Test::Builder.html#is_passing">#</a><b>is_passing</b></dt>
<dd>

<pre><code>my $ok = $builder-&gt;is_passing;</code></pre>

<p>Indicates if the test suite is currently passing.</p>

<p>More formally, it will be false if anything has happened which makes it impossible for the test suite to pass. True otherwise.</p>

<p>For example, if no tests have run <code>is_passing()</code> will be true because even though a suite with no tests is a failure you can add a passing test to it and start passing.</p>

<p>Don&#39;t think about it too much.</p>

</dd>
<dt id="summary"><a class="permalink" href="./Test::Builder.html#summary">#</a><b>summary</b></dt>
<dd>

<pre><code>my @tests = $Test-&gt;summary;</code></pre>

<p>A simple summary of the tests so far. True for pass, false for fail. This is a logical pass/fail, so todos are passes.</p>

<p>Of course, test #1 is $tests[0], etc...</p>

</dd>
<dt id="details"><a class="permalink" href="./Test::Builder.html#details">#</a><b>details</b></dt>
<dd>

<pre><code>my @tests = $Test-&gt;details;</code></pre>

<p>Like <code>summary()</code>, but with a lot more detail.</p>

<pre><code>$tests[$test_num - 1] =
        { &#39;ok&#39;       =&gt; is the test considered a pass?
          actual_ok  =&gt; did it literally say &#39;ok&#39;?
          name       =&gt; name of the test (if any)
          type       =&gt; type of test (if any, see below).
          reason     =&gt; reason for the above (if any)
        };</code></pre>

<p>&#39;ok&#39; is true if Test::Harness will consider the test to be a pass.</p>

<p>&#39;actual_ok&#39; is a reflection of whether or not the test literally printed &#39;ok&#39; or &#39;not ok&#39;. This is for examining the result of &#39;todo&#39; tests.</p>

<p>&#39;name&#39; is the name of the test.</p>

<p>&#39;type&#39; indicates if it was a special test. Normal tests have a type of &#39;&#39;. Type can be one of the following:</p>

<pre><code class="plaintext">skip        see skip()
todo        see todo()
todo_skip   see todo_skip()
unknown     see below</code></pre>

<p>Sometimes the Test::Builder test counter is incremented without it printing any test output, for example, when <code>current_test()</code> is changed. In these cases, Test::Builder doesn&#39;t know the result of the test, so its type is &#39;unknown&#39;. These details for these tests are filled in. They are considered ok, but the name and actual_ok is left <code>undef</code>.</p>

<p>For example &quot;not ok 23 - hole count # TODO insufficient donuts&quot; would result in this structure:</p>

<pre><code>$tests[22] =    # 23 - 1, since arrays start from 0.
  { ok        =&gt; 1,   # logically, the test passed since its todo
    actual_ok =&gt; 0,   # in absolute terms, it failed
    name      =&gt; &#39;hole count&#39;,
    type      =&gt; &#39;todo&#39;,
    reason    =&gt; &#39;insufficient donuts&#39;
  };</code></pre>

</dd>
<dt id="todo"><a class="permalink" href="./Test::Builder.html#todo">#</a><b>todo</b></dt>
<dd>

<pre><code>my $todo_reason = $Test-&gt;todo;
my $todo_reason = $Test-&gt;todo($pack);</code></pre>

<p>If the current tests are considered &quot;TODO&quot; it will return the reason, if any. This reason can come from a <code>$TODO</code> variable or the last call to <code>todo_start()</code>.</p>

<p>Since a TODO test does not need a reason, this function can return an empty string even when inside a TODO block. Use <code>$Test-&gt;in_todo</code> to determine if you are currently inside a TODO block.</p>

<p><code>todo()</code> is about finding the right package to look for <code>$TODO</code> in. It&#39;s pretty good at guessing the right package to look at. It first looks for the caller based on <code>$Level + 1</code>, since <code>todo()</code> is usually called inside a test function. As a last resort it will use <code>exported_to()</code>.</p>

<p>Sometimes there is some confusion about where <code>todo()</code> should be looking for the <code>$TODO</code> variable. If you want to be sure, tell it explicitly what $pack to use.</p>

</dd>
<dt id="find_TODO"><a class="permalink" href="./Test::Builder.html#find_TODO">#</a><b>find_TODO</b></dt>
<dd>

<pre><code>my $todo_reason = $Test-&gt;find_TODO();
my $todo_reason = $Test-&gt;find_TODO($pack);</code></pre>

<p>Like <code>todo()</code> but only returns the value of <code>$TODO</code> ignoring <code>todo_start()</code>.</p>

<p>Can also be used to set <code>$TODO</code> to a new value while returning the old value:</p>

<pre><code>my $old_reason = $Test-&gt;find_TODO($pack, 1, $new_reason);</code></pre>

</dd>
<dt id="in_todo"><a class="permalink" href="./Test::Builder.html#in_todo">#</a><b>in_todo</b></dt>
<dd>

<pre><code>my $in_todo = $Test-&gt;in_todo;</code></pre>

<p>Returns true if the test is currently inside a TODO block.</p>

</dd>
<dt id="todo_start"><a class="permalink" href="./Test::Builder.html#todo_start">#</a><b>todo_start</b></dt>
<dd>

<pre><code>$Test-&gt;todo_start();
$Test-&gt;todo_start($message);</code></pre>

<p>This method allows you declare all subsequent tests as TODO tests, up until the <code>todo_end</code> method has been called.</p>

<p>The <code>TODO:</code> and <code>$TODO</code> syntax is generally pretty good about figuring out whether or not we&#39;re in a TODO test. However, often we find that this is not possible to determine (such as when we want to use <code>$TODO</code> but the tests are being executed in other packages which can&#39;t be inferred beforehand).</p>

<p>Note that you can use this to nest &quot;todo&quot; tests</p>

<pre><code>$Test-&gt;todo_start(&#39;working on this&#39;);
# lots of code
$Test-&gt;todo_start(&#39;working on that&#39;);
# more code
$Test-&gt;todo_end;
$Test-&gt;todo_end;</code></pre>

<p>This is generally not recommended, but large testing systems often have weird internal needs.</p>

<p>We&#39;ve tried to make this also work with the TODO: syntax, but it&#39;s not guaranteed and its use is also discouraged:</p>

<pre><code>TODO: {
    local $TODO = &#39;We have work to do!&#39;;
    $Test-&gt;todo_start(&#39;working on this&#39;);
    # lots of code
    $Test-&gt;todo_start(&#39;working on that&#39;);
    # more code
    $Test-&gt;todo_end;
    $Test-&gt;todo_end;
}</code></pre>

<p>Pick one style or another of &quot;TODO&quot; to be on the safe side.</p>

</dd>
<dt id="todo_end"><a class="permalink" href="./Test::Builder.html#todo_end">#</a><code>todo_end</code></dt>
<dd>

<pre><code>$Test-&gt;todo_end;</code></pre>

<p>Stops running tests as &quot;TODO&quot; tests. This method is fatal if called without a preceding <code>todo_start</code> method call.</p>

</dd>
<dt id="caller"><a class="permalink" href="./Test::Builder.html#caller">#</a><b>caller</b></dt>
<dd>

<pre><code>my $package = $Test-&gt;caller;
my($pack, $file, $line) = $Test-&gt;caller;
my($pack, $file, $line) = $Test-&gt;caller($height);</code></pre>

<p>Like the normal <code>caller()</code>, except it reports according to your <code>level()</code>.</p>

<p><code>$height</code> will be added to the <code>level()</code>.</p>

<p>If <code>caller()</code> winds up off the top of the stack it report the highest context.</p>

</dd>
</dl>

<h1 id="EXIT-CODES"><a class="permalink" href="./Test::Builder.html#EXIT-CODES">#</a><a id="EXIT"></a>EXIT CODES</h1>

<p>If all your tests passed, Test::Builder will exit with zero (which is normal). If anything failed it will exit with how many failed. If you run less (or more) tests than you planned, the missing (or extras) will be considered failures. If no tests were ever run Test::Builder will throw a warning and exit with 255. If the test died, even after having successfully completed all its tests, it will still be considered a failure and will exit with 255.</p>

<p>So the exit codes are...</p>

<pre><code class="plaintext">0                   all tests successful
255                 test died or all passed but wrong # of tests run
any other number    how many failed (including missing or extras)</code></pre>

<p>If you fail more than 254 tests, it will be reported as 254.</p>

<h1 id="THREADS"><a class="permalink" href="./Test::Builder.html#THREADS">#</a>THREADS</h1>

<p>In perl 5.8.1 and later, Test::Builder is thread-safe. The test number is shared by all threads. This means if one thread sets the test number using <code>current_test()</code> they will all be effected.</p>

<p>While versions earlier than 5.8.1 had threads they contain too many bugs to support.</p>

<p>Test::Builder is only thread-aware if threads.pm is loaded <i>before</i> Test::Builder.</p>

<p>You can directly disable thread support with one of the following:</p>

<pre><code>$ENV{T2_NO_IPC} = 1</code></pre>

<p>or</p>

<pre><code>no Test2::IPC;</code></pre>

<p>or</p>

<pre><code class="plaintext">Test2::API::test2_ipc_disable()</code></pre>

<h1 id="MEMORY"><a class="permalink" href="./Test::Builder.html#MEMORY">#</a>MEMORY</h1>

<p>An informative hash, accessible via <code>details()</code>, is stored for each test you perform. So memory usage will scale linearly with each test run. Although this is not a problem for most test suites, it can become an issue if you do large (hundred thousands to million) combinatorics tests in the same run.</p>

<p>In such cases, you are advised to either split the test file into smaller ones, or use a reverse approach, doing &quot;normal&quot; (code) compares and triggering <code>fail()</code> should anything go unexpected.</p>

<p>Future versions of Test::Builder will have a way to turn history off.</p>

<h1 id="EXAMPLES"><a class="permalink" href="./Test::Builder.html#EXAMPLES">#</a>EXAMPLES</h1>

<p>CPAN can provide the best examples. <a href="./Test::Simple.html">Test::Simple</a>, <a href="./Test::More.html">Test::More</a>, <a href="./Test::Exception.html">Test::Exception</a> and <a href="./Test::Differences.html">Test::Differences</a> all use Test::Builder.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./Test::Builder.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<h2 id="INTERNALS"><a class="permalink" href="./Test::Builder.html#INTERNALS">#</a>INTERNALS</h2>

<p><a href="Test2.html">Test2</a>, <a href="./Test2::API.html">Test2::API</a></p>

<h2 id="LEGACY"><a class="permalink" href="./Test::Builder.html#LEGACY">#</a>LEGACY</h2>

<p><a href="./Test::Simple.html">Test::Simple</a>, <a href="./Test::More.html">Test::More</a></p>

<h2 id="EXTERNAL"><a class="permalink" href="./Test::Builder.html#EXTERNAL">#</a>EXTERNAL</h2>

<p><a href="./Test::Harness.html">Test::Harness</a></p>

<h1 id="AUTHORS"><a class="permalink" href="./Test::Builder.html#AUTHORS">#</a>AUTHORS</h1>

<p>Original code by chromatic, maintained by Michael G Schwern &lt;schwern@pobox.com&gt;</p>

<h1 id="MAINTAINERS"><a class="permalink" href="./Test::Builder.html#MAINTAINERS">#</a>MAINTAINERS</h1>

<dl>

<dt id="Chad-Granum"><a class="permalink" href="./Test::Builder.html#Chad-Granum">#</a><a id="Chad-Granum-&lt;exodist@cpan.org&gt;"></a><a id="Chad"></a><a id="Chad-Granum-exodist-cpan.org"></a>Chad Granum &lt;exodist@cpan.org&gt;</dt>
<dd>

</dd>
</dl>

<h1 id="COPYRIGHT"><a class="permalink" href="./Test::Builder.html#COPYRIGHT">#</a>COPYRIGHT</h1>

<p>Copyright 2002-2008 by chromatic &lt;chromatic@wgz.org&gt; and Michael G Schwern &lt;schwern@pobox.com&gt;.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>See <i>http://www.perl.com/perl/misc/Artistic.html</i></p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
